export default {
  data() {
    return {
      disabled: false,
      text: this.$t('login.get-yzm-code'),
	  codetText:this.$t('login.get-yzm-code'),
    };
  },
  methods: {
    sendCode(e) {
      if (this.disabled) return;
      this.disabled = true;
      let n = 60;
      // this.text = this.$t('login.yzm-code-residue') + n + "s";
	  if(e){
		  this.codetText = this.$t('login.yzm-code-residue') + n + "s";
	  }else{
		  this.text = this.$t('login.yzm-code-residue') + n + "s";
	  }
	  
      const run = setInterval(() => {
        n = n - 1;
        if (n < 0) {
          clearInterval(run);
        }
       if(e){
       		  this.codetText = this.$t('login.yzm-code-residue') + n + "s";
       }else{
       		  this.text = this.$t('login.yzm-code-residue') + n + "s";
       }
		if(e){
				  if (this.codetText < this.$t('login.yzm-code-residue') + 0 + "s") {
				    this.disabled = false;
				    this.codetText = this.$t('login.yzm-code-retrieve');
				  }
		}else{
				  if (this.text < this.$t('login.yzm-code-residue') + 0 + "s") {
				    this.disabled = false;
				    this.text = this.$t('login.yzm-code-retrieve');
				  }
		}
        
		
		
		
      }, 1000);
    }
  }
};